package com.softme.trade.engine.setup;

import java.util.List;

import com.softme.trade.model.Currency;
import com.softme.trade.model.dao.CurrencyDAO;
import com.softme.trade.util.BeanFactory;

/**
 * Classe criada para fazer setup das moedas do sistema
 * 
 * @author Mews
 * 
 */
public class SetupCurrency implements Setup
{
	CurrencyDAO currencyDAO = (CurrencyDAO) BeanFactory.getBean("currencyDAO", CurrencyDAO.class);


	public boolean canRun()
	{
		List<Currency> list = this.currencyDAO.loadAll();

		if (list.size() >= 2)
			return false;

		return true;
	}

	public boolean run()
	{
		addCurrency("AUD","Australian Dollar ");
		addCurrency("GBP","British Pound ");
		addCurrency("EUR","Euro ");
		addCurrency("JPY","Japanese Yen ");
		addCurrency("CHF","Swiss Franc ");
		addCurrency("USD","US Dollar ");
		addCurrency("AFN","Afghanistan Afghani ");
		addCurrency("ALL","Albanian Lek ");
		addCurrency("DZD","Algerian Dinar ");
		addCurrency("AOA","Angolan Kwanza ");
		addCurrency("ARS","Argentine Peso ");
		addCurrency("AMD","Armenian Dram ");
		addCurrency("AWG","Aruban Florin ");
		addCurrency("AUD","Australian Dollar ");
		addCurrency("AZN","Azerbaijan New Manat ");
		addCurrency("BSD","Bahamian Dollar ");
		addCurrency("BHD","Bahraini Dinar ");
		addCurrency("BDT","Bangladeshi Taka ");
		addCurrency("BBD","Barbados Dollar ");
		addCurrency("BYR","Belarusian Ruble ");
		addCurrency("BZD","Belize Dollar ");
		addCurrency("BMD","Bermudian Dollar ");
		addCurrency("BTN","Bhutan Ngultrum ");
		addCurrency("BOB","Bolivian Boliviano ");
		addCurrency("BAM","Bosnian Mark ");
		addCurrency("BWP","Botswana Pula ");
		addCurrency("BRL","Brazilian Real ");
		addCurrency("GBP","British Pound ");
		addCurrency("BND","Brunei Dollar ");
		addCurrency("BGN","Bulgarian Lev ");
		addCurrency("BIF","Burundi Franc ");
		addCurrency("XOF","CFA Franc BCEAO ");
		addCurrency("XAF","CFA Franc BEAC ");
		addCurrency("XPF","CFP Franc ");
		addCurrency("KHR","Cambodian Riel ");
		addCurrency("CAD","Canadian Dollar ");
		addCurrency("CVE","Cape Verde Escudo ");
		addCurrency("KYD","Cayman Islands Dollar ");
		addCurrency("CLP","Chilean Peso ");
		addCurrency("CNY","Chinese Yuan/Renminbi ");
		addCurrency("COP","Colombian Peso ");
		addCurrency("KMF","Comoros Franc ");
		addCurrency("CDF","Congolese Franc ");
		addCurrency("CRC","Costa Rican Colon ");
		addCurrency("HRK","Croatian Kuna ");
		addCurrency("CUC","Cuban Convertible Peso ");
		addCurrency("CUP","Cuban Peso ");
		addCurrency("CYP","Cyprus Pound ");
		addCurrency("CZK","Czech Koruna ");
		addCurrency("DKK","Danish Krone ");
		addCurrency("DJF","Djibouti Franc ");
		addCurrency("DOP","Dominican R Peso ");
		addCurrency("XCD","East Caribbean Dollar ");
		addCurrency("EGP","Egyptian Pound ");
		addCurrency("SVC","El Salvador Colon ");
		addCurrency("EEK","Estonian Kroon ");
		addCurrency("ETB","Ethiopian Birr ");
		addCurrency("EUR","Euro ");
		addCurrency("FKP","Falkland Islands Pound ");
		addCurrency("FJD","Fiji Dollar ");
		addCurrency("GMD","Gambian Dalasi ");
		addCurrency("GEL","Georgian Lari ");
		addCurrency("GHS","Ghanaian New Cedi ");
		addCurrency("GIP","Gibraltar Pound ");
		addCurrency("XAU","Gold (oz) ");
		addCurrency("GTQ","Guatemalan Quetzal ");
		addCurrency("GNF","Guinea Franc ");
		addCurrency("GYD","Guyanese Dollar ");
		addCurrency("HTG","Haitian Gourde ");
		addCurrency("HNL","Honduran Lempira ");
		addCurrency("HKD","Hong Kong Dollar ");
		addCurrency("HUF","Hungarian Forint ");
		addCurrency("ISK","Iceland Krona ");
		addCurrency("INR","Indian Rupee ");
		addCurrency("IDR","Indonesian Rupiah ");
		addCurrency("IRR","Iranian Rial ");
		addCurrency("IQD","Iraqi Dinar ");
		addCurrency("ILS","Israeli New Shekel ");
		addCurrency("JMD","Jamaican Dollar ");
		addCurrency("JPY","Japanese Yen ");
		addCurrency("JOD","Jordanian Dinar ");
		addCurrency("KZT","Kazakhstan Tenge ");
		addCurrency("KES","Kenyan Shilling ");
		addCurrency("KWD","Kuwaiti Dinar ");
		addCurrency("KGS","Kyrgyzstanian Som ");
		addCurrency("LAK","Lao Kip ");
		addCurrency("LVL","Latvian Lats ");
		addCurrency("LBP","Lebanese Pound ");
		addCurrency("LSL","Lesotho Loti ");
		addCurrency("LRD","Liberian Dollar ");
		addCurrency("LYD","Libyan Dinar ");
		addCurrency("LTL","Lithuanian Litas ");
		addCurrency("MOP","Macau Pataca ");
		addCurrency("MKD","Macedonian Denar ");
		addCurrency("MGA","Malagasy Ariary ");
		addCurrency("MWK","Malawi Kwacha ");
		addCurrency("MYR","Malaysian Ringgit ");
		addCurrency("MVR","Maldive Rufiyaa ");
		addCurrency("MTL","Maltese Lira ");
		addCurrency("MRO","Mauritanian Ouguiya ");
		addCurrency("MUR","Mauritius Rupee ");
		addCurrency("MXN","Mexican Peso ");
		addCurrency("MDL","Moldovan Leu ");
		addCurrency("MNT","Mongolian Tugrik ");
		addCurrency("MAD","Moroccan Dirham ");
		addCurrency("MZN","Mozambique New Metical ");
		addCurrency("MMK","Myanmar Kyat ");
		addCurrency("ANG","NL Antillian Guilder ");
		addCurrency("NAD","Namibia Dollar ");
		addCurrency("NPR","Nepalese Rupee ");
		addCurrency("NZD","New Zealand Dollar ");
		addCurrency("NIO","Nicaraguan Cordoba Oro ");
		addCurrency("NGN","Nigerian Naira ");
		addCurrency("KPW","North Korean Won ");
		addCurrency("NOK","Norwegian Kroner ");
		addCurrency("OMR","Omani Rial ");
		addCurrency("PKR","Pakistan Rupee ");
		addCurrency("PAB","Panamanian Balboa ");
		addCurrency("PGK","Papua New Guinea Kina ");
		addCurrency("PYG","Paraguay Guarani ");
		addCurrency("PEN","Peruvian Nuevo Sol ");
		addCurrency("PHP","Philippine Peso ");
		addCurrency("PLN","Polish Zloty ");
		addCurrency("QAR","Qatari Rial ");
		addCurrency("RON","Romanian New Lei ");
		addCurrency("RUB","Russian Rouble ");
		addCurrency("RWF","Rwandan Franc ");
		addCurrency("WST","Samoan Tala ");
		addCurrency("STD","Sao Tome/Principe Dobra ");
		addCurrency("SAR","Saudi Riyal ");
		addCurrency("RSD","Serbian Dinar ");
		addCurrency("SCR","Seychelles Rupee ");
		addCurrency("SLL","Sierra Leone Leone ");
		addCurrency("XAG","Silver (oz) ");
		addCurrency("SGD","Singapore Dollar ");
		addCurrency("SKK","Slovak Koruna ");
		addCurrency("SIT","Slovenian Tolar ");
		addCurrency("SBD","Solomon Islands Dollar ");
		addCurrency("SOS","Somali Shilling ");
		addCurrency("ZAR","South African Rand ");
		addCurrency("KRW","South-Korean Won ");
		addCurrency("LKR","Sri Lanka Rupee ");
		addCurrency("SHP","St Helena Pound ");
		addCurrency("SDG","Sudanese Pound ");
		addCurrency("SRD","Suriname Dollar ");
		addCurrency("SZL","Swaziland Lilangeni ");
		addCurrency("SEK","Swedish Krona ");
		addCurrency("CHF","Swiss Franc ");
		addCurrency("SYP","Syrian Pound ");
		addCurrency("TWD","Taiwan Dollar ");
		addCurrency("TZS","Tanzanian Shilling ");
		addCurrency("THB","Thai Baht ");
		addCurrency("TOP","Tonga Pa'anga ");
		addCurrency("TTD","Trinidad/Tobago Dollar ");
		addCurrency("TND","Tunisian Dinar ");
		addCurrency("TRY","Turkish New Lira ");
		addCurrency("TMM","Turkmenistan Manat ");
		addCurrency("USD","US Dollar ");
		addCurrency("UGX","Uganda Shilling ");
		addCurrency("UAH","Ukraine Hryvnia ");
		addCurrency("UYU","Uruguayan Peso ");
		addCurrency("AED","United Arab Emir Dirham ");
		addCurrency("VUV","Vanuatu Vatu ");
		addCurrency("VEB","Venezuelan Bolivar ");
		addCurrency("VND","Vietnamese Dong ");
		addCurrency("YER","Yemeni Rial ");
		addCurrency("ZMK","Zambian Kwacha ");
		addCurrency("ZWD","Zimbabwe Dollar ");

		return true;
	}

	/**
	 * Adiciona as principais moedas
	 */
	
	private void addCurrency(String acronym,String description)
	{
		Currency currency = new Currency();
		currency.setAcronym(acronym);
		currency.setDescription(description);
		
		this.currencyDAO.save(currency);
	}
	
}
